﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="DT_KH._Default" %>

<%@ Register Assembly="vdc_Interface" Namespace="Vdc.Interface" TagPrefix="cc1" %>

<%@ Register Assembly="vdc_Grid_NET" Namespace="Vdc.Grid" TagPrefix="cc2" %>

<%@ Register Assembly="vdc_Calendar2_Net" Namespace="Vdc.Calendar2" TagPrefix="Vdc" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <script type="text/javascript">
        //select record Grid và gán dữ liệu vào textbox
        function onRecordSelect(arrSelectedRecords) {
            var s_ma_nv="";
            var s_ten_nv = "";
            var s_ngay_bd = "";

            var e = "";
            var cr_date = "";
            var cr_month = "";
            var cr_year = "";
            for (var i = 0; i < Grid1.SelectedRecords.length; i++) {
                var record = arrSelectedRecords[i];
                s_ma_nv = record.Ma_nv;
                s_ten_nv = record.Ten_nv;

                e = new Date(record.Ngay_bd);
                cr_date = e.getDate();
                cr_month = e.getMonth() + 1;
                cr_year = e.getFullYear();
                
            }
            $("input[id$='txt_ma_nv']").val(s_ma_nv);
            $("input[id$='txt_ten_nv']").val(s_ten_nv);
            $("input[id$='txt_ngay_bd']").val(cr_date + "/" + cr_month + "/" + cr_year);
        }
        //end

        //validate textbox
        function validateform_c() {
            if ($("input[id$='txt_ma_nv']").val() == "") {
                alert("Mã nghiệp vụ rỗng");
                return false;
            }
            if ($("input[id$='txt_ten_nv']").val() == "") {
                alert("Tên nghiệp vụ rỗng");
                return false;
            }
            if ($("input[id$='txt_ngay_bd']").val() == "") {
                alert("Ngày bắt đầu rỗng");
                return false;
            }
            return true;
        }
        //end validate
        function requestPermission() {
            return confirm("Bạn có muốn xóa không ?");
        }
        //Gán giá trị ngày vào text 
        function onDateChange(sender, selectedDate) {
            var formattedDate;
            formattedDate = sender.formatDate(selectedDate, "dd/MM/yyyy");
            //txt_ngay_bd.value(formattedDate);
            $("input[id$='txt_ngay_bd']").val(formattedDate);
        }
        //end

        //Mask textbox
        jQuery(function ($) {
            $("input[id$='txt_ngay_bd']").mask("99/99/9999");
        });
        //end
    </script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <table class="data_tbl" cellspacing="0" cellpadding="0" width="90%" style="margin-top: 20px;">
        <tbody>
            <tr>
                <td align="left" colspan="2" style="padding-top: 3px">
                    <!--Tiêu đề màn hình-->
                    <h3 class="tbl_title">
                        <img height="21" align="absMiddle" width="20" src="image/vnpt_ico.png" style="padding-left: 4px;
                            padding-top: 3px">
                        <span ten_goc="Label1" class="css_tieude" id="ctl00_ContentPlaceHolder1_Label1">Quản
                            lí danh mục nghiệp vụ</span>
                    </h3>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <table cellspacing="5" cellpadding="1" width="100%">
                        <tbody>
                            <tr>
                                <td align="left" class="C_out">
                                    <div class="C_in" style="padding: 35px;">
                                        <table cellspacing="0" cellpadding="1">
                                            <tbody>
                                                <tr>
                                                    <td align="left">
                                                        <span class="css_gchu" id="ctl00_ContentPlaceHolder1_Label2" style="width: 130px;
                                                            display: inline-block">Mã nghiệp vụ</span>
                                                    </td>
                                                    <td align="left">
                                                        <%--<input type="text" id="input1" />--%>
                                                        <%--<cc2:OboutTextBox ID="txt_ma_nv"
                                                            runat="server"></cc2:OboutTextBox>--%>
                                                        <cc1:VdcTextBox ID="txt_ma_nv"
                                                            runat="server"></cc1:VdcTextBox>

                                                            <%--<asp:TextBox ID="txt_ma_nv" runat="server"></asp:TextBox>--%>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="left">
                                                        <span class="css_gchu" id="Span1" style="width: 130px; display: inline-block">Tên nghiệp
                                                            vụ</span>
                                                    </td>
                                                    <td align="left">

                                                        <%--<cc2:obouttextbox ID="txt_ten_nv" runat="server" Width="212px"></cc2:obouttextbox>--%>
                                                        <cc1:VdcTextBox ID="txt_ten_nv" runat="server" Width="212px"></cc1:VdcTextBox>

                                                        <%--<asp:TextBox ID="txt_ten_nv" runat="server" Width="212px"></asp:TextBox>--%>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="left">
                                                        <span class="css_gchu" id="Span2" style="width: 130px; display: inline-block">Ngày bắt đầu</span>
                                                    </td>
                                                    <td align="left">

                                                        <%--<cc2:obouttextbox ID="txt_ngay_bd" runat="server" Width="100px" />--%>
                                                        <cc1:VdcTextBox ID="txt_ngay_bd" runat="server" Width="100px"></cc1:VdcTextBox>
                                                        <%--<ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender5" runat="server" TargetControlID="txt_ngay_bd"
                                                            MaskType="Date" Mask='99/99/9999' ClearMaskOnLostFocus="False" ></ajaxToolkit:MaskedEditExtender>--%>
                                                        <%--<obout:calendar
                                                            ID="Calendar1" runat="server" DatePickerMode="true" OnClientDateChanged="onDateChange"
                                                            DatePickerImagePath ="vstyles/date_picker1.gif" 
                                                            DatePickerImageTooltip="Ngày bắt đầu">
                                                        </obout:calendar>--%>
                                                        <Vdc:Calendar ID="Calendar1" runat="server" DatePickerMode="true" OnClientDateChanged="onDateChange"
                                                            DatePickerImagePath ="vstyles/date_picker1.gif" 
                                                            DatePickerImageTooltip="Ngày bắt đầu">
                                                        </Vdc:Calendar>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <table cellspacing="1" cellpadding="1">
                                        <tbody>
                                            <tr>
                                                <td align="left">
                                                    <span class="css_gchu" id="Span5" style="width: 50px; display: inline-block">Tìm
                                                    </span>
                                                </td>
                                                <td align="left">
                                                    <%--<cc2:obouttextbox ID="txt_tk" runat="server"></cc2:obouttextbox>--%>

                                                    <cc1:VdcTextBox ID="txt_tk" runat="server"></cc1:VdcTextBox>
                                                    <%--<asp:TextBox ID="txt_tk" runat="server"></asp:TextBox>--%>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <table cellspacing="1" cellpadding="1">
                                        <tbody>
                                            <tr>
                                                <td>
                                                <%--<cc2:oboutbutton runat="server" Text="Tìm kiếm" id="bt_timkiem" 
                                                        onclick="bt_timkiem_Click" FolderStyle="btstyles/plain/OboutButton"></cc2:oboutbutton>--%>
                                                    <cc1:VdcButton runat="server" Text="Tìm kiếm" id="bt_timkiem" 
                                                        onclick="bt_timkiem_Click" FolderStyle="btstyles/plain/OboutButton">
                                                    </cc1:VdcButton>
                                                </td>
                                                <td>
                                                 <%--  <asp:Button ID="bt_luu" CssClass="css_button" Text="Lưu" runat="server" OnClientClick="return validateform();"
                                                        OnClick="bt_luu_Click" />--%>
                                                        <%--<cc2:oboutbutton ID="bt_luu" runat="server" Text="Lưu" Height="25px" 
                                                        OnClientClick=" return validateform_c();" onclick="bt_luu_Click"
                                                        FolderStyle="btstyles/plain/OboutButton">
                                                        </cc2:oboutbutton>--%>
                                                    <cc1:VdcButton ID="bt_luu" runat="server" Text="Lưu" Height="25px" 
                                                        OnClientClick=" return validateform_c();" onclick="bt_luu_Click"
                                                        FolderStyle="btstyles/plain/OboutButton">
                                                    </cc1:VdcButton>
                                                </td>
                                                <td>
                                                    <%--<asp:Button ID="bt_them" CssClass="css_button" Text="Thêm" runat="server" OnClick="bt_them_Click" />--%>
                                                    <%--<cc2:oboutbutton ID="bt_them" Text="Thêm" runat="server" 
                                                        OnClick="bt_them_Click" Height="25px" FolderStyle="btstyles/plain/OboutButton">
                                                    </cc2:oboutbutton>--%>

                                                    <cc1:VdcButton  ID="bt_them" Text="Thêm" runat="server" 
                                                        OnClick="bt_them_Click" Height="25px" FolderStyle="btstyles/plain/OboutButton">
                                                    </cc1:VdcButton>
                                                </td>
                                                <td>
                                                   <%-- <asp:Button ID="bt_xoa" CssClass="css_button" Text="Xóa" runat="server" OnClick="bt_xoa_Click" />--%>
                                                    <%--<cc2:oboutbutton ID="bt_xoa" Text="Xóa" runat="server"  onclick="bt_xoa_Click"
                                                        OnClientClick="return requestPermission();" Height="25px" 
                                                        FolderStyle="btstyles/plain/OboutButton">
                                                    </cc2:oboutbutton>--%>
                                                    <cc1:VdcButton ID="bt_xoa" Text="Xóa" runat="server"  onclick="bt_xoa_Click"
                                                        OnClientClick="return requestPermission();" Height="25px" 
                                                        FolderStyle="btstyles/plain/OboutButton">
                                                    </cc1:VdcButton>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
                <td valign="top" style="padding-top: 5px; padding-right: 5px; padding-bottom: 5px;">
                    <cc2:Grid ID="Grid1" runat="server" CallbackMode="true" Serialize="true" AllowAddingRecords="false"
                        AllowFiltering="false" AutoGenerateColumns="false" OnRebind="Grid1_Rebind" AllowPageSizeSelection="false"
                        AllowRecordSelection="true" AllowMultiRecordSelection="false" 
                        KeepSelectedRecords="true" FolderExports="resources/exports"
                        FolderStyle="vstyles/premiere_blue" OnSelect="Grid1_Select">
                        <ClientSideEvents OnClientSelect="onRecordSelect" />
                        <Columns>
                            <cc2:Column DataField="ID" HeaderText="ID" Visible="false" />
                            <cc2:Column DataField="Ma_nv" HeaderText="Mã nghiệp vụ" Width="150" />
                            <cc2:Column DataField="Ten_nv" HeaderText="Tên nghiệp vụ" Width="150" />
                            <cc2:Column DataField="Ngay_bd" HeaderText="Ngày bắt đầu"  DataFormatString="{0:dd/MM/yyyy}"  Width="200" />
                        </Columns>
                    </cc2:Grid>
                    

                </td>
            </tr>
        </tbody>
    </table>
</asp:Content>
